<%@ page import="java.util.List" %>
<%@ page import="feifei.second.User" %><%--
  Created by IntelliJ IDEA.
  User: 乔见东方姑娘
  Date: 2023/8/14
  Time: 21:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户信息修改</title>
</head>
<body>
<table border="1px" width="600px" align="center" cellspacing="0" cellpadding="10px">
    <caption><b>用户列表</b></caption>
    <tr>
        <th>序号</th>
        <th>用户名</th>
        <th>出生日期</th>
        <th>兴趣爱好</th>
        <th>出生城市</th>
        <th>性别</th>
        <th>操作</th>
    </tr>

<%--    //从session获取list--%>
<%--    // ServletContext servletContext = this.getServletConfig().getServletContext();--%>

    <%
   
            List<User> userList = (List<User>) session.getAttribute("user");
                    if(userList!=null&&userList.size()>=0){
                    for (int i = 0; i < userList.size(); i++) {
                        User user = userList.get(i);

                        %>
                    <tr>
                        <th><%=i + 1%></th>
                        <th><%=user.getUsername()%></th>
                        <th><%=user.getDateOfBirth()%></th>
                        <th><%=user.getHobbies()%></th>
                        <th><%=user.getBirthCity()%></th>
                        <th><%=user.getGender()%></th>
                        <td>
                            <a href="<%=request.getContextPath()%>/homework/putUser.action?id=<%=i%>">编辑</a>
                            <a href="<%=request.getContextPath()%>/deleteUser.action?id=<%=i%>">删除</a>
                        </td>
                    </tr>
    <%
      }}
    %>


</body>
</html>
